From 246e6cd0b9693cc9d3c7655ee42b288dab0db0b2 Mon Sep 17 00:00:00 2001 From: Carlos Garnacho Date: Thu, 5 Jun 2014 21:09:46 +0200 Subject: [PATCH] combobox: Fix reentrancy in gtk_combo_box_popdown() If called when already popped down, warnings would be issued due to priv->grab_pointer being unexpectedly NULL, this would happen in regular operation when selecting items in appears-as-list mode. So both add a NULL check for priv->grab_pointer, and bail out early if the popup window is already hidden. --- gtk/gtkcombobox.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 2404886557..fd6e9224aa 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -2546,9 +2546,13 @@ gtk_combo_box_popdown (GtkComboBox *combo_box) if (!gtk_widget_get_realized (GTK_WIDGET (combo_box))) return; + if (!gtk_widget_is_drawable (priv->popup_window)) + return; + if (priv->grab_keyboard) gdk_device_ungrab (priv->grab_keyboard, GDK_CURRENT_TIME); - gdk_device_ungrab (priv->grab_pointer, GDK_CURRENT_TIME); + if (priv->grab_pointer) + gdk_device_ungrab (priv->grab_pointer, GDK_CURRENT_TIME); gtk_widget_hide (priv->popup_window); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->button), -- 2.30.2